package com.woniuxy.credit_loans.product_liu.controller;

import com.woniuxy.credit_loans.entity.ModeOfRepayment;
import com.woniuxy.credit_loans.product_liu.service.ModeOfRepaymentService;
import com.woniuxy.credit_loans.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "产品付款方式的相关接口")
@RestController
@RequestMapping("/averages")
public class ModeOfRepaymentController {
    @Autowired
    private ModeOfRepaymentService modeOfRepaymentService;

    @ApiOperation(value = "查询所有付款方式的名称及利率")
    @GetMapping("")
    public Result selectAllRepayment(){
        List<ModeOfRepayment> modeOfRepayments = modeOfRepaymentService.selectAllRepayment();
        return Result.ok().data("average",modeOfRepayments);
    }
}
